// miniprogram/pages/menu/menu.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    bannarylist:[{
      imgurl:'cloud://cloud1-6gbd0zlz6f7bd939.636c-cloud1-6gbd0zlz6f7bd939-1305405598/banner/p2.jpg'

    },{
      imgurl:'cloud://cloud1-6gbd0zlz6f7bd939.636c-cloud1-6gbd0zlz6f7bd939-1305405598/banner/p3.png'

    },{
      imgurl:'cloud://cloud1-6gbd0zlz6f7bd939.636c-cloud1-6gbd0zlz6f7bd939-1305405598/banner/p1.jpg'

    }],
    swiperoption:{
      indicatorDots:true,
      autoplay:true,
      time:2000
    },
    asdieData:[
      {
        title:'最新推荐',
        isActive:true
      },
      {
        title:'大师咖啡',
        isActive:false

      },
      {
        title:'拿铁',
        isActive:false
      },
      {
        title:'瑞那冰',
        isActive:false
      }
    ]

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  // 切换侧边
  toaggeAsideMen:function(e){
    console.log(e)
    if(e.currentTarget.dataset.active){
      return;
    }
    for(let i = 0;i < this.data.asdieData.length; i++){
      if(this.data.asdieData[i].isActive){
        this.data.asdieData[i].isActive=false;
        break;
      }
    }
    this.data.asdieData[e.currentTarget.dataset.index].isActive=true;

    this.setData({
      asdieData:this.data.asdieData
    })
  }
})